<%-- 
    Document   : sendMessage
    Created on : 21/08/2011, 5:32:26 PM
    Author     : David Bullock 42062222
--%>
<script type="text/javascript">
    function check(){
        // This function is checking the fields if they are blank.
        var body = document.getElementById('body').value;
        if (body=="") 
        {
            alert("Please enter your message then re-submit.");
            return false;
        }  

        alert("Sending message successed.");
        return false;
    }
        
</script>

<%@ include file="../header.jsp" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
     <%String userID =(String)request.getParameter("userID");%>
<div id="content-container">
    <div id="content">
        <!-- Content goes here -->
        <h3 align="center"> </h3><!--making a space between table and header-->
        <div id="tablecontainer">
            <form:form method="post" commandName="message"><%--TODO @David Fix this need to escape the "" in get attribute--%>
                <span hidden="true"><form:input path="uid" id="uid" value="<%=userID%>"/></span> 
                <div style="color: red"><b><form:errors path="uidErr" cssClass="error"/><%if (userID==null) {out.println("The page was improperally formed, try going back and trying again");}%></b></div>
                
                <lable>Title:</lable></br>
                <form:input size="78" path="title" id="title"/><br/>
                
                <lable>Body:</lable></br>
                <form:textarea wrap="virtual" cols="60" path="message" id="body"/><br/> 
                
                <form:radiobutton path="type" value="private"/>Private
                <form:radiobutton path="type" value="public"/>Public
                <br/><br/>
                <input type="submit" onClick=" return check()" value="Send">

            </form:form>
                
        </div>
    </div>
</div>		

<%@ include file="../footer.jsp" %>